﻿using System.Configuration;
using System.Data;
using Microsoft.ApplicationBlocks.Data;

namespace Core.AdminGroupUser
{
    public class AdminGroupUserDAL
    {
        private readonly string Conn = ConfigurationManager.ConnectionStrings["ConnectionString"].ToString();

        public IDataReader GetGroupsByUserId(int userId)
        {
            return SqlHelper.ExecuteReader(Conn, "AdminGroupUser_GetGroupsByUserId", userId);
        }                

        public void Create(int groupId, int userId)
        {
            SqlHelper.ExecuteScalar(Conn, "AdminGroupUser_Create", groupId, userId);
        }

        public void DeleteByUserId(int userId)
        {
            SqlHelper.ExecuteNonQuery(Conn, "AdminGroupUser_DeleteByUserId", userId);
        }
    }
}